package com.geen.tuoke.utils

import android.media.AudioManager
import android.media.SoundPool
import com.geen.tuoke.MyApplication

/**
 * @Author LuoJi
 * @Date 2021/4/30-11:35
 * @Desc
 */
object SoundPoolUtils {

    private var soundPool :SoundPool = SoundPool(8, AudioManager.STREAM_NOTIFICATION, 100)

    fun playSound(raw:Int){
        val soundId = soundPool.load(MyApplication.instance,raw,1)
        soundPool.setOnLoadCompleteListener { soundPool, sampleId, status ->
            soundPool.play(soundId,1f,1f,0,0,1f)
        }
    }

    fun playSystemSound(){
       val soundId = soundPool.load("/etc/Scan_new.ogg", 1)
        soundPool.setOnLoadCompleteListener { soundPool, sampleId, status ->
            soundPool.play(soundId,1f,1f,0,0,1f)
        }
    }
}